<?php
	require('config.php');
    $user_id=$_REQUEST['user_id'];
    $sql="select h.type,h.title,o.* from ".$oto."_help_orders as o,".$oto."_help as h where h.id=o.helpId and (o.userId='{$user_id}' or o.acceptUserId='{$user_id}') and o.isDel='0' ";
	$result=$db->query($sql);
	while($row=$result->fetch_assoc()){
		$order[]=$row;//将取得的所有数据赋值给person_info数组
	}
	$sql="select * from `".$oto."_help_notice` where isDel='0' order by createTime DESC";
	$result=$db->query($sql);
	while($row=$result->fetch_assoc()){
		$wb_gonggao[]=$row;//将取得的所有数据赋值给person_info数组
	}
	$sql="select ".$oto."_help.*,".$oto."_help_message.id as xiaoxi_id,".$oto."_help_message.msg_type,".$oto."_help.userId as wb_user_id,".$oto."_help_message.userId as xiaoxi_user_id from ".$oto."_help_message,".$oto."_help where ".$oto."_help_message.userId='{$user_id}' and ".$oto."_help_message.isDel='0' and ".$oto."_help.id=".$oto."_help_message.helpId and (".$oto."_help_message.msg_type='0' or ".$oto."_help_message.msg_type='2' )";
		//file_put_contents("tsxx.txt", "\r\n".$sql."\r\n", FILE_APPEND);
	$result=$db->query($sql);
	while($row=$result->fetch_assoc()){
		$message[]=$row;//将取得的所有数据赋值给person_info数组
	}
	if(isset($message)) $data[0]=count($message);
	else $data[0]=0;
	if(isset($wb_gonggao)) $data[1]=count($wb_gonggao);
	else $data[1]=0;
	if(isset($order)) $data[2]=count($order);
	else $data[2]=0;
    
	
	echo json_encode($data);
?>